package by.gravity.common.utils;

import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Date;

public class CalendarUtil {

	public static String getMonth(int month) {

		String nameMonth = new DateFormatSymbols().getMonths()[month];
		char first = Character.toUpperCase(nameMonth.charAt(0));
		return first + nameMonth.substring(1);
	}

	public static String getDay(int day) {

		if (day < 10) {
			return "0" + day;
		}
		return String.valueOf(day);
	}

	public static String convertToFriendlyWithoutYer(Date date) {

		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);

		return calendar.get(Calendar.DAY_OF_MONTH) + " " + getMonth(calendar.get(Calendar.MONTH));
	}

}
